<?php

class Admin_Form_PageListTool extends Zend_Dojo_Form
{
    protected $_options = array(
        null    => '无',
        'star'   => '星级',
        'status'  => '状态',
        'createtime' => '创建日期',
        'updatetime'  => '更新日期',);

    public function __construct($fid = null)
    {
        parent::__construct();
        
        $this->addElement('FilteringSelect', 'filter', array(
                          'label' => '分类',
                          'storeId' => 'categoryStore',
                          'storeType' => 'dojo.data.ItemFileReadStore',
                          'autoComplete' => true,
                          'storeParams' => array('url' => '/admin/category/list/fid/'.$fid),
                          'dijitParams' => array('searchAttr' => 'name')));
        
        $this->addElement('FilteringSelect', 'sort', array('label'=>'排序：', 'multiOptions'=>$this->_options));
        
        $submit = $this->createElement('SubmitButton', 'submit');
        $submit->setLabel('过滤显示');
        $submit->setIgnore(true);
        $this->addElement($submit);
    
        // 装饰器
        $this->setElementDecorators(array(
                array('DijitElement'),
                array('Errors'),
                array('Description'),
                array('Label', array('separator'=>' ')),
                array('HtmlTag', array('tag' => 'span', 'class'=>'element-group')),
        ));
        // 提交按钮去掉label
        $submit->setDecorators(array(
            array('DijitElement'),
            array('Description'),
            array('HtmlTag', array('tag' => 'span', 'class'=>'submit-group')),
        ));
        
        $this->addDecorator('FormElements')
             ->addDecorator('HtmlTag', array('tag' => '<div>', 'class' => 'listTool'))
             ->addDecorator('Form');
    }


}

